type Partial<T> = {
  [P in keyof T]?: T[P];
};
type DeepPartial<T> = {
  [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
};
export {};
interface Iperson {
  name: string;
  age: number;
  address: {
    province: string;
    city: string;
    location: string;
  };
}
// Partial无法处理内部的属性，定义的p属性address如果少一个属性就会报错。
type Person = Partial<Iperson>;
type Person2 = DeepPartial<Iperson>;
let p: Person = {
  name: "tom",
  address: {
    province: "shanghai",
    city: "shanghai",
    location: "pudong",
  },
};
let p2: Person2 = {
  name: "john",
  address: {
    city: "shanghai",
  },
};
